import { settlementTypeList } from '../const'
import ZmUpload from '@/components/ZmUpload/components/main'

export const detailTabsList = [
  {
    label: '概况信息',
    name: 'BaseInfo'
  },
  {
    label: '审批记录',
    name: 'ApprovalRecord'
  },
  {
    label: '回款记录',
    name: 'MoneyBack'
  },
  {
    label: '发票记录',
    name: 'InvoiceRecord'
  },
  {
    label: '卡券激活',
    name: 'CardCouponActive'
  },
  {
    label: '退货记录',
    name: 'ReturnGoods'
  },
  {
    label: '操作日志',
    name: 'OperationLog'
  }
]

export const baseInfoList = (context) => {
  // console.log(context.tempInfoData, 'infofofo')
  let isTypeThree = context.infoData.type === '3' // 客情
  let isTypeFour = context.infoData.type === '4' // 包场
  let isTypeFive = context.infoData.type === '5' // 客诉
  let isTypeSix = context.infoData.type === '6' // 实物
  let isTypeWenLv = context.infoData.type === '7' // 文旅

  return [
    {
      hasIcon: true,
      name: '销售单类型',
      label: 'typeName'
    },
    {
      hide: isTypeFour || isTypeFive || isTypeSix || isTypeWenLv,
      name: '业务类型',
      label: 'businessTypeName'
    },
    {
      hasIcon: true,
      name: '销售单名称',
      label: 'name'
    },
    {
      name: '销售单号',
      label: 'orderNo'
    },
    {
      hasIcon: true,
      name: '关联客户',
      label: 'customerName'
      // render: h => {
      //   let obj = {
      //     customerId: context.infoData.customerId,
      //     customerName: context.infoData.customerId
      //   }
      //   return [
      //     <zm-button
      //       type="text"
      //       onClick={() => {
      //         context.goCustomerDetail(obj)
      //       }}
      //     >
      //       {context.infoData.customerName}
      //     </zm-button>
      //   ]
      // }
    },
    {
      name: '客户类型',
      label: 'customerTypeName'
    },
    {
      hasIcon: true,
      hide: isTypeThree || isTypeFive,
      name: '签约主体',
      label: 'companyTypeName'
    },
    {
      hasIcon: true,
      hide: isTypeThree || isTypeFive,
      name: '合同形式',
      label: 'contractTypeName'
    },
    // 客情销售单（审批操作） 详情 新增业务场景字段
    {
      hide: !isTypeThree && isTypeSix,
      hasIcon: true,
      name: '业务场景',
      label: 'businessSceneName'
    },
    {
      hasIcon: isTypeFive,
      // hide: isTypeThree,
      name: '相关附件',
      render: (h) => {
        // const saleTypeList = ['1', '2', '3', '4', '5']
        return [
          <div class="df-center">
            <span class="dib" v-show={!context.infoData.enclosureUrl}>
              无附件
            </span>
            <zm-enclosure
              v-show={context.infoData.enclosureUrl}
              fileUrl={context.infoData.enclosureUrl}
            />
            <ZmUpload
              // v-show={saleTypeList.includes(context.saleOrderType)}
              class="ml5"
              http-request={context.fileUpload}
              accept=".rar,.zip,.doc,.docx,.pdf,.png,.jpg,.pptx"
              limit={1}
              single-file-size={5}
            >
              <zm-button size="mini">{!context.infoData.enclosureUrl ? '上传' : '替换'}</zm-button>
            </ZmUpload>
          </div>
        ]
      }
    },
    {
      hasIcon: true,
      name: '签单日期',
      label: 'signDate'
    },
    {
      hasIcon: true,
      hide: isTypeThree || isTypeFive,
      name: '是否开票',
      render: (h) => {
        return [<span>{context.infoData.isInvoice === '1' ? '是' : '否'}</span>]
      }
    },
    {
      hide: isTypeThree || isTypeFive || context.infoData.isInvoice === '0',
      name: '预填开票主体',
      label: 'invoiceContent'
    },
    {
      hasIcon: true,
      hide: isTypeThree || isTypeFive || context.infoData.isInvoice === '0',
      name: '发票类型',
      render: (h) => {
        return [
          <span>
            {context.infoData.isInvoice === '1' ? context.infoData.invoiceTypeName : '--'}
          </span>
        ]
      }
    },
    {
      name: '归属业务员',
      label: 'operator'
    },
    {
      name: '归属部门',
      label: 'apartmentName'
    },
    {
      name: '备注信息',
      label: 'remark'
      // render: h => {
      // 实物销售单 从销售产品中获取备注信息
      // return isTypeSix ? (
      // {context.infoData.productList.remark}
      // <span>{context.tempInfoData.remark}</span>
      // ) : (
      // {context.infoData.remark}
      // )
      // }
    },
    {
      hasIcon: true,
      hide: !isTypeFive,
      name: '投诉类型',
      label: 'complaintTypeName'
    },
    {
      hasIcon: true,
      hide: !isTypeFive,
      name: '投诉备注',
      label: 'complaintRemark'
    },
    {
      hide:
        context.infoData.checkStatus === '0' ||
        context.infoData.type === '4' ||
        context.infoData.type === '6' ||
        context.infoData.type === '7',
      name: '秘钥',
      label: 'secretNo'
    },
    {
      hasIcon: true,
      hide: isTypeThree || isTypeFive,
      name: '结算方式',
      render: (h) => {
        let labelValue = settlementTypeList.filter(
          (i) => context.infoData.settlementType === i.value
        )
        return [<span>{labelValue && labelValue.length > 0 ? labelValue[0].name : '--'}</span>]
      }
    },
    {
      hasIcon: true,
      name: '所属公司',
      label: 'companyName'
    },
    {
      hide: !isTypeFour && !isTypeSix && !isTypeWenLv,
      hasIcon: isTypeFour,
      name: '销售单总价',
      label: 'saleTotalPrice'
    },
    {
      hide: !isTypeFour,
      hasIcon: isTypeFour,
      name: '包场人数',
      label: 'number'
    },
    {
      hide: !isTypeFour,
      hasIcon: isTypeFour,
      name: '销售单单价',
      label: 'salePrice'
    },
    {
      hide: !isTypeFour,
      hasIcon: isTypeFour,
      name: '最低销售单价',
      label: 'minSalePrice'
    },
    {
      hide: !isTypeFour,
      hasIcon: isTypeFour,
      name: '提成比例',
      // label: 'ruleProportion',
      render: (h, row) => {
        return [<span>{context.infoData.ruleProportion}%</span>]
      }
    },
    {
      hide: !isTypeFour,
      // hasIcon: isTypeFour,
      name: '预估提成',
      label: 'proportionPrice'
    }
  ]
}
export const productInfoList = (context) => {
  return [
    {
      name: '产品编号',
      label: 'productCode'
    },
    {
      name: '产品名称',
      render: (h) => {
        return [
          <zm-button
            type="text"
            onClick={() => context.goProductDetail(context.infoData.productId)}
          >
            {context.infoData.productName}
          </zm-button>
        ]
      }
    },
    {
      name: '产品类型',
      label: 'productTypeName'
    },
    {
      hide: context.infoData.productType !== '3',
      name: '卡名称',
      label: 'cardName'
    },
    {
      name: '业务类型',
      label: 'businessTypeName'
    },
    {
      hasIcon: true,
      hide: context.infoData.productType !== '4',
      name: '次卡绑定产品',
      label: 'couponProductName'
    },
    {
      hasIcon: true,
      name: '售货方式',
      label: 'saleTypeName'
    },
    {
      hasIcon: true,
      hide:
        context.infoData.productType === '5' ||
        (context.infoData.productType === '3' && context.infoData.isCustomize === '1'),
      name: '产品面值',
      label: 'parValue'
    },
    {
      hasIcon: true,
      hide: context.infoData.productType !== '5',
      name: '优惠券面值',
      label: 'parValue'
    },
    {
      hasIcon: true,
      hide: context.infoData.productType === '3' && context.infoData.isCustomize === '1',
      name: '销售单价(元)',
      label: 'salePriceName'
    },
    {
      hasIcon: true,
      name: '销售单总额',
      render: (h) => {
        return [<span>{'¥' + context.infoData.saleTotalPrice}</span>]
      }
    },
    {
      hide: context.infoData.productType !== '3', // 不为点卡
      name: '是否开放充值',
      render: h => {
        return [
          <span>{context.infoData.isOpenRecharge === '1' ? '是' : '否'}</span>
        ]
      }
    },
    {
      // hide: context.infoData.productType === '4', // 不为次卡
      name: '转赠配置',
      render: (h) => {
        return [<span>{context.infoData.isGive === '1' ? '可转赠' : '不可转赠'}</span>]
      }
    },
    {
      hide: !['1', '3', '5', '4'].includes(context.infoData.productType),
      name: '解绑配置',
      render: h => {
        return [
          <span>
            {context.infoData.isUnbundling === '1' ? '可解绑' : '不可解绑'}
          </span>
        ]
      }
    },
    {
      name: '卡面预览',
      render: (h, row) => {
        console.log(row)
        if (!context.infoData.cardSurfaceImage) {
          return [<span>--</span>]
        }
        return [
          <el-image src={context.infoData.cardSurfaceImage} style="height: 40px; padding-top:15px; line-height:30px;" fit='contain' preview-src-list={[context.infoData.cardSurfaceImage]} />

          // <img src={context.infoData.cardSurfaceImage} style="width: 30px; height: 30px;" />
        ]
      }
    },
    {
      hide: context.infoData.productType !== '3', // 不为点卡
      name: '是否开放现金补差',
      render: h => {
        return [
          <span>
            {context.infoData.isCashDiff === '1' ? '是' : '否'}
          </span>
        ]
      }
    },
    // 销售单、审批 详情 新增 产品使用范围
    {
      hide: context.infoData.productType === '4' && context.infoData.productType === '2', // 不为次卡,卖品券
      name: '产品使用范围',
      label: 'useScopeName'
    },
    // 点卡的几个独有配置
    // {
    //   hide: context.infoData.productType !== '3',
    //   name: '理论成本',
    //   label: 'theoryCostPrice'
    // },
    // {
    //   hide: context.infoData.productType !== '3',
    //   name: '实际成本',
    //   label: 'practiceCostPrice'
    // },
    {
      hasIcon: context.infoData.type === '2',
      hide: context.infoData.productType !== '3',
      name: '销售比例',
      render: (h) => {
        return [
          <span>{context.infoData.saleScalePrice + ':' + context.infoData.saleScalePoint}</span>
        ]
      }
    },
    {
      hasIcon: context.infoData.type === '2',
      hide: context.infoData.productType !== '3',
      name: '消费比例',
      render: (h) => {
        return [
          <span>
            {context.infoData.consumptionScalePrice + ':' + context.infoData.consumptionScalePoint}
          </span>
        ]
      }
    },
    {
      hasIcon: true,
      hide: context.infoData.productType !== '3',
      name: '销售类型',
      render: (h) => {
        return [<span>{context.infoData.isCustomize === '1' ? '自定义金额' : '统一金额'}</span>]
      }
    },
    {
      hasIcon: true,
      name: '数量(张)',
      label: 'number'
    },
    {
      // hide: +context.infoData.type !== '3', // 客情没有提成
      name: '提成',
      render: (h) => {
        return [<span>{+context.infoData.proportion + '%'}</span>]
      }
    },
    {
      // hide: +context.infoData.type !== '3', // 客情没有提成
      name: '预估提成(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.proportionPrice}</span>]
      }
    },
    {
      hide: context.infoData.productType !== '3',
      name: '销售折扣',
      render: (h) => {
        return [<span>{context.infoData.cardSaleScale + '%'}</span>]
      }
    },
    {
      hasIcon: true,
      name: '有效期类型',
      label: 'expiredTypeName'
    },
    {
      hasIcon: true,
      name: '电影券有效期',
      label: 'expiredName'
    },
    {
      hasIcon: true,
      name: '备注说明',
      label: 'productRemark'
    }
  ]
}

export const moneyBackList = (context) => {
  console.log(context.infoData, 'context.infoDatacontext.infoData')
  return [
    {
      name: '退款金额(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.refundTotalPrice}</span>]
      }
    },
    {
      name: '实际应收(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.actualSaleTotalPrice}</span>]
      }
    },
    {
      name: '已回款金额(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.payMoney}</span>]
      }
    },
    {
      name: '剩余应收(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.surplusActualSaleTotalPrice}</span>]
      }
    },
    {
      name: '已开票金额(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.invoicePrice}</span>]
      }
    },
    {
      name: '未开票金额(元)',
      render: (h) => {
        return [<span>{'¥' + context.infoData.surplusInvoicePrice}</span>]
      }
    },
    {
      hide: !(context.infoData.type === '1' || context.infoData.type === '2'),
      name: '签收回执单',
      render: (h) => {
        return [
          <div class="df-center">
            <span class="mr20">{context.infoData.customerName + '签收回执单'}</span>
            <zm-button
              size="mini"
              type="success"
              onClick={() => {
                context.previewReceipt()
              }}
            >
              预览
            </zm-button>

            <zm-button
              size="mini"
              onClick={() => {
                context.downReceipt()
              }}
            >
              下载
            </zm-button>
          </div>
        ]
      }
    },
    {
      hide: !(context.infoData.type === '1' || context.infoData.type === '2'),
      name: '回执单附件',
      render: (h) => {
        return [
          <div class="df-center">
            <span class="dib" v-show={!context.infoData.receiptUrl}>
              无附件
            </span>
            <zm-enclosure
              v-show={context.infoData.receiptUrl}
              fileUrl={context.infoData.receiptUrl}
            />
            <ZmUpload
              class="ml5"
              http-request={context.receiptFileUpload}
              accept=".rar,.zip,.doc,.docx,.pdf"
              limit={1}
              single-file-size={5}
            >
              <zm-button size="mini">{!context.infoData.receiptUrl ? '上传' : '替换'}</zm-button>
            </ZmUpload>
          </div>
        ]
      }
    }
  ]
}

export const returnGoodsInfoList = (context) => {
  return [
    {
      name: '产品状态',
      render: (h) => {
        return [<span>{context.infoData.isActive === '1' ? '已激活' : '未激活'}</span>]
      }
    },
    {
      name: '退货数量(张)',
      label: 'refundNumber'
    },
    {
      name: '退货金额',
      render: (h) => {
        return [<span>{'¥' + context.returnData.refundTotalPrice}</span>]
      }
    },
    {
      name: '退货说明',
      label: 'refundRemark'
    }
  ]
}

export const returnMoneyColumns = (context) => {
  return [
    {
      prop: 'returnedNo',
      label: '回款编号',
      minWidth: 120
    },

    {
      prop: 'returnedTime',
      label: '回款日期',
      minWidth: 120
    },
    {
      prop: 'returnedTypeName',
      label: '回款类型',
      minWidth: 120
    },
    {
      prop: 'operator',
      label: '回款操作人',
      minWidth: 120
    },
    {
      prop: 'salesmanName',
      label: '回款所属业务员',
      minWidth: 140
    },
    {
      prop: 'returnedPeriodsName',
      label: '回款期数',
      minWidth: 120
    },
    {
      prop: 'salesmanName',
      label: '回款所属业务员',
      minWidth: 140
    },
    // 销售单详情中的回款记录增加 '本期回款提成' 字段
    {
      prop: 'returnedPrice',
      label: '本期回款提成',
      minWidth: 120
    },
    {
      label: '回款金额(元)',
      minWidth: 120,
      render: (h, row) => {
        return (
          <span class={row.returnedType.toString() !== '1' ? 'fc-error' : ''}>
            {row.returnedMoney}
          </span>
        )
      }
    },
    // {
    //   prop: 'balanceAmount',
    //   label: '红冲金额(元)',
    //   minWidth: 120
    // },
    {
      prop: 'gatheringName',
      label: '收款单位',
      minWidth: 120
    },
    {
      prop: 'transactionNo',
      label: '交易流水号',
      minWidth: 120
    },
    {
      label: '逾期状态',
      minWidth: 120,
      render: (h, row) => {
        return (
          <el-tag type={row.overdueStatus === '1' ? 'success' : 'danger'}>
            {row.overdueStatusName}
          </el-tag>
        )
      }
    },
    {
      prop: 'overdueDay',
      label: '逾期天数(天)',
      minWidth: 120
    },
    {
      prop: 'remark',
      label: '备注',
      minWidth: 120
    }
  ]
}

export const invoiceColumns = (context) => {
  return [
    {
      prop: 'makeTime',
      label: '开票日期',
      minWidth: 120
    },
    {
      label: '发票状态',
      minWidth: 120,
      render: (h, row) => {
        let obj = { 1: 'success', 2: 'danger' }
        let buttonType = obj[+row.isRecycle]
        return <el-tag type={buttonType}>{row.recycleName}</el-tag>
      }
    },
    {
      prop: 'amount',
      label: '开票金额',
      minWidth: 120
    },
    {
      prop: 'invoiceTypeName',
      label: '票据类型',
      minWidth: 120
    },
    {
      prop: 'invoiceNumber',
      label: '发票号码',
      minWidth: 120
    },
    {
      prop: 'invoiceCoding',
      label: '发票代码',
      minWidth: 120
    },
    {
      prop: 'invoiceMain',
      label: '开票主体',
      minWidth: 120
    },
    {
      prop: 'operator',
      label: '开票操作人',
      minWidth: 120
    },
    {
      prop: 'updateTime',
      label: '录入时间',
      minWidth: 120
    },
    {
      prop: 'billRemark',
      label: '发票内容',
      minWidth: 120
    }
  ]
}

export const returnGoodsColumns = (context) => {
  let noThreeHide = context.form.checkStatus !== '3'
  let _saleOrderType = context.infoData.type
  return [
    {
      prop: 'orderNo',
      label: '销售单号'
    },
    {
      prop: 'createTime',
      label: '退货提交时间'
    },
    {
      prop: 'updateTime',
      label: '退货审批通过时间'
    },
    {
      hide: !noThreeHide,
      prop: 'realName',
      label: '归属业务员'
    },
    {
      hide: !noThreeHide,
      prop: 'updateTime',
      label: '修改时间'
    },
    {
      hide: noThreeHide || _saleOrderType === '7',
      prop: 'productName',
      label: '退货产品'
    },
    {
      hide: noThreeHide || _saleOrderType === '7',
      prop: 'refundNumber',
      label: '退货数量'
    },
    {
      hide: noThreeHide || _saleOrderType === '7',
      prop: 'backDelivery',
      label: '运费退款'
    },
    {
      hide: noThreeHide,
      prop: 'refundAmount',
      label: '退货金额(元)'
    },
    {
      hide: noThreeHide,
      prop: 'remark',
      label: '备注'
    },
    {
      label: '操作',
      fixed: 'right',
      minWidth: 120,
      render: (h, row) => {
        return [
          <el-button
            type="text"
            onclick={() => {
              context.onDetail(row)
            }}
          >
            详情
          </el-button>,
          <el-button
            v-show={row.checkStatus !== '1' && row.checkStatus !== '3'}
            type="text"
            onclick={() => {
              context.onDelete(row)
            }}
          >
            删除
          </el-button>,
          <el-button
            v-show={row.checkStatus !== '1' && row.checkStatus !== '3'}
            type="text"
            onclick={() => {
              context.submitAppro(row)
            }}
          >
            提交审批
          </el-button>,
          <el-button
            v-show={row.checkStatus === '1'}
            type="text"
            onclick={() => {
              context.cancelAppro(row)
            }}
          >
            撤销审批
          </el-button>
        ]
      }
    }
  ]
}

export const activeColumns = (ctx) => {
  return [
    {
      prop: 'productName',
      label: '产品名称'
    },

    {
      prop: 'productCode',
      label: '产品编号'
    },
    {
      prop: 'productTypeName',
      label: '产品类型'
    },
    {
      prop: 'businessTypeName',
      label: '业务类型'
    },
    {
      prop: 'saleTypeName',
      label: '销售方式'
    },
    {
      prop: 'parValue',
      label: '产品面值(元)'
    },
    {
      prop: 'number',
      label: '数量(张)'
    },
    {
      prop: 'activeAccountName',
      label: '激活操作人'
    },
    {
      prop: 'activeTime',
      label: '激活日期'
    },
    {
      prop: 'productRemark',
      label: '备注说明'
    }
  ]
}

export const activeInfoList = (ctx) => {
  let labelName =
    ctx.infoData.productType === '3' || ctx.infoData.productType === '4' ? '卡号区间' : '券号区间'
  console.log(ctx.infoData.type, 'ctx.infoData.type')
  return [
    {
      label: 'expiredType',
      name: '有效期类型',
      hide: ['4', '6', '7'].includes(ctx.infoData.type)
    },
    {
      label: 'expiredTime',
      name: '有效期',
      hide: ['4', '6', '7'].includes(ctx.infoData.type)
    },
    {
      hide: ctx.infoData.saleType === '2' || ctx.infoData.type === '6' || ctx.infoData.type === '7',
      label: 'codeIdDetail',
      name: labelName
    },
    { label: 'activeAccount', name: '激活操作人' },
    { label: 'activeTime', name: '激活时间' }
  ]
}

export const operatColumns = (ctx) => {
  return [
    {
      prop: 'updateTime',
      label: '操作时间'
    },

    {
      prop: 'operator',
      label: '操作人员'
    },
    {
      prop: 'typeName',
      label: '操作类型'
    }
  ]
}

export const customizePriceColumns = (context) => {
  return [
    {
      label: '自定义金额',
      minWidth: 100,
      render: (h, row, index) => {
        return [<span>金额{index + 1}</span>]
      }
    },
    {
      label: '销售单价',
      minWidth: 100,
      render: (h, row) => {
        return [<span class="ml5">￥{row.unitPrice}</span>]
      }
    },
    {
      label: '产品面值',
      minWidth: 100,
      render: (h, row, index) => {
        return [
          <span>
            内含{row.unitPrice}元,折合卡内点数{row.unitPoint}点
          </span>
        ]
      }
    },
    {
      prop: 'num',
      label: '数量(张)',
      minWidth: 100
    },
    {
      prop: 'totalPrice',
      label: '总额(元)',
      minWidth: 100
    }
  ]
}

export const returnCustomizeColumns = (context) => {
  return [
    {
      label: '自定义金额',
      minWidth: 80,
      render: (h, row, index) => {
        return [<span>金额{index + 1}</span>]
      }
    },
    {
      label: '销售单价',
      minWidth: 100,
      render: (h, row) => {
        return [<span class="ml5">￥{row.unitPrice}</span>]
      }
    },
    {
      prop: 'num',
      label: '可退数量(张)',
      minWidth: 100
    },
    {
      prop: 'totalPrice',
      label: '销售总额',
      minWidth: 80
    },
    {
      prop: 'customizeRefund',
      label: '退货数量',
      minWidth: 120,
      render: (h, row) => {
        return [
          <zm-input
            value={row.customizeRefund}
            on-input={(val) => {
              row.customizeRefund = val
            }}
            onChange={() => context.customizeRefund(row.customizeRefund)}
            class="w100"
          />,
          <span class="ml5">张</span>
        ]
      }
    }
  ]
}

export const returnDetailCustomizeColumns = (context) => {
  return [
    {
      label: '自定义金额',
      minWidth: 80,
      render: (h, row, index) => {
        return [<span>金额{index + 1}</span>]
      }
    },
    {
      label: '销售单价(元)',
      minWidth: 100,
      render: (h, row) => {
        return [<span class="ml5">￥{row.unitPrice}</span>]
      }
    },
    {
      prop: 'num',
      label: '可退数量(张)',
      minWidth: 100
    },
    {
      prop: 'backNum',
      label: '退货数量(张)',
      minWidth: 120
    }
  ]
}

export const cinemaInfoList = (context) => {
  return [
    {
      name: '选择影院',
      type: 'cinemaType'
    },
    {
      name: '影院',
      type: 'url'
    },
    {
      name: '影片',
      type: 'filmName'
    },
    {
      name: '包场时间',
      type: 'date',
      start: 'startDate',
      end: 'endDate'
    },
    {
      name: '影厅备注',
      label: 'hallRemark'
    }
  ]
}

export const wenlvInfoList = (context) => {
  return [
    {
      name: '活动类型',
      label: 'typeName'
    },
    {
      name: '活动场地',
      label: 'address'
    },
    {
      name: '活动时间',
      type: 'date',
      start: 'startTime',
      end: 'endTime'
    },
    {
      name: '销售总额计算方式',
      label: 'calculationMethodName'
    },
    {
      name: '销售单价',
      label: 'unitPrice'
    },
    {
      name: '活动人数',
      label: 'joinCount'
    },
    {
      name: '销售总额',
      label: 'totalSalePrice'
    },
    {
      name: '活动备注',
      label: 'remark'
    }
  ]
}

export const cinemaColumns = (ctx) => {
  return [
    {
      prop: 'cinemaName',
      label: '影院名称'
    },
    {
      prop: 'cinemaCode',
      label: '影院编码'
    },
    {
      prop: 'interfaceName',
      label: '系统商'
    },
    {
      prop: 'cinemaLineName',
      label: '院线'
    },
    {
      label: '地区',
      render: (h, row) => {
        return [
          <span>
            {row.provinceName}-{row.cityName}-{row.countyName}
          </span>
        ]
      }
    }
  ]
}

export const productListColumns = (ctx) => {
  return [
    {
      prop: 'name',
      label: '商品名称'
    },
    {
      prop: 'minSalePrice',
      label: '最低销售单价'
    },
    {
      prop: 'price',
      label: '销售单价'
    },
    {
      prop: 'number',
      label: '数量'
    },
    {
      prop: 'deliveryMoney',
      label: '运费'
    },
    {
      label: '商品总额',
      render: (h, row) => {
        return <span>{(+row.price * +row.number + (+row.deliveryMoney || 0)).toFixed(2)}</span>
      }
    }
  ]
}

export const returnProductColumns = (ctx) => {
  return [
    {
      prop: 'name',
      label: '产品名称'
    },
    {
      prop: 'number',
      label: '退货数量'
    },
    {
      prop: 'price',
      label: '销售单价'
    },
    {
      prop: 'backDelivery',
      label: '运费退款'
    },
    {
      label: '商品退货总额',
      prop: 'totalPrice'
    }
  ]
}

// 文旅退货信息

export const returnWenlvColumns = (ctx) => {
  return [
    {
      prop: 'typeName',
      label: '活动类型'
    },
    {
      prop: 'calculationMethodName',
      label: '销售总额计算方式'
    },
    {
      prop: 'address',
      label: '活动场地'
    },
    {
      label: '活动时间',
      prop: 'totalPrice',
      render: (h, row) => {
        return (
          <span>
            {row.startTime}-{row.endTime}
          </span>
        )
      }
    },
    {
      label: '销售单价(元)',
      prop: 'unitPrice'
    },
    {
      label: '退货数量(人)',
      prop: 'refundNumber'
    },
    {
      label: '退货金额(元)',
      prop: 'refundAmount'
    }
  ]
}

export const base = (info) => {
  return [
    { name: '方案ID', label: 'id' },
    { name: '方案名称', label: 'name' },
    { name: '有效期', label: 'timeTypeDes' },
    { name: '方案类型', label: 'typeDes' },
    // 如果 方案类型为1:根据销售单绑定卡券数量 则不显示 支付类型
    { hide: info.form.type === '1', name: '支付类型', label: 'payTypeDes' },
    { name: '触发场景', label: 'sceneDes' },
    { name: '使用产品', label: 'productTypeDes' },
    { name: '领取方式', label: 'receiveTypeDes' },
    { name: '修改日期', label: 'updateTime' }
  ]
}
